Ext.define('CDR.view.report.TariffReport', {
	extend: 'Ext.panel.Panel',
	alias: 'widget.tariff-call-report',
	id: 'x-cdr-tariff-report',
	title: 'Report',
	layout: 'border',
	border: false,
	initComponent: function(){
		var me = this;
		me.items = [{
			split: true,
			title: 'Type',
			collapsible: true,
			width: '15%',
			xtype: 'panel',
			region: 'west',
			layout:'border',
			items: [{
				id: 'x-cdr-tariff-report-treetype',
				xtype: 'treepanel',
				region: 'center',
				store: Ext.create('CDR.store.report.ReportTypeTreeStore'),
			},{
				xtype: 'panel',
				region: 'south',
				height: '45%',
				split: true,
				title: 'Preset',
				collapsible: true,
			}]
		},{
			xtype: 'panel',
			region: 'center',
			border: false,
			layout: 'border',
			disabled: true,
			id: 'x-cdr-tariff-report-condition',
			items: [{
				xtype: 'panel',
				region: 'north',
				border: false,
				collapsible: true,
				title: 'Condition',
				split: true,
				height: 140,
				layout: {
					type: 'hbox',
					align: 'stretch'
				},
				defaults:{
					flex: 1,
					headerPosition: 'left',
					xtype: 'tariff-call-report-grid'
				},
				items: [{
					title: 'Entity',
					type: 'entity',
					name: 'entity'
				},{
					xtype: 'panel',
					title: 'Period',
					layout: 'fit',
					bodyPadding: 10,
					items:[{
				        xtype: 'radiogroup',
				        name: 'period',
				        columns: 1,
				        vertical: true,
				        defaults: {
				        	xtype: 'container',
				        	layout: 'hbox'
				        },
				        items: [{
				        	name: 'presetValue',
							items: [{
								xtype:'radio',
								width: 80,
								inputValue: 'preset',
								boxLabel: 'Preset',
								checked: true,
								name: 'period'
							}, {
								xtype: 'combobox',
								width: 200,
								store: Ext.create('Ext.data.Store', {
						   			fields: [{name :'key'}, {name: 'text'}],
						   			data: [
						   			{key: 'today', text: 'Today'},
						   			{key: 'yesterday', text: 'Yesterday'},
						   			{key: 'this_week', text: 'This week'},
						   			{key: 'last_week', text: 'Last week'},
						   			{key: 'this_month', text: 'This month'},
						   			{key: 'last_month', text: 'Last month'},
						   			{key: 'this_year', text: 'This year'},
						   			{key: 'all_call', text: 'All call'}]
						   		}),
						   		valueField: 'key',
						   		displayField: 'text',
						   		value: 'today'
							}]				        	
				        },{
				        	name: 'lastValue',
							items: [{
								xtype:'radio',
								width: 80,
								boxLabel: 'Last',
								inputValue: 'last',
								name: 'period'
							},{
								xtype:'numberfield',
								width: 50,
								margin: '0 5 0 0',
								value: 1,
							}, {
								xtype: 'combobox',
								width: 140,
								store: Ext.create('Ext.data.Store', {
						   			fields: [{name :'key'}, {name: 'text'}],
						   			data: [
						   			{key: 'hours', text: 'Hours'},
						   			{key: 'days', text: 'Days'},
						   			{key: 'weeks', text: 'Weeks'},
						   			{key: 'months', text: 'Months'},
						   			{key: 'years', text: 'Years'}]
						   		}),
						   		valueField: 'key',
						   		displayField: 'text',
						   		value: 'hours'
							}]				        	
				        },{
				        	name: 'fromValue',
							items: [{
								xtype:'radio',
								width:80,
								name: 'period',
								inputValue: 'from',
								boxLabel: 'From'
							}, {
								xtype: 'datefield',
								name: 'fromDate',
								margin: '0 5 0 0',
								flex: 1
							}, {
								xtype: 'displayfield',
								width: 20,
								margin: '0 5 0 0',
								value: '~'
							} ,{
								xtype: 'datefield',
								name: 'toDate',
								flex: 1
							}]				        	
				        }]
				    }]
				},{
					title: 'Filters',
					disabled: true
					
				}]
			}, {
				xtype: 'panel',
				id: 'x-cdr-tariff-report-run',
				region: 'center',
				tbar: ['-', {
					text: 'Run now',
					action: 'run',
					iconCls: 'icon-run'
				}, '->',{
					iconCls: 'icon-pdf'
				}, '-', {
					iconCls: 'icon-excel'
				}]
			}]
		}];
		me.callParent(arguments);
		
	},
	listeners: {
		afterrender: function(comp){
		}
	}
	
});